package cn.autumnorange.user.entity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.Assert;

public class MyGramtedAuthority implements GrantedAuthority {

  private static final long serialVersionUID = 500L;
  private String role;

  public String getRole() {
    return role;
  }

  public void setRole(String role) {
    this.role = role;
  }

  public MyGramtedAuthority() {};

  public MyGramtedAuthority(String role) {
    Assert.hasText(role, "A granted authority textual representation is required");
    this.role = role;
  }
  //
  @Override
  public String getAuthority() {
    return this.role;
  }

  public String setAuthority(String role) {
    return this.role;
  }

  @Override
  public int hashCode() {
    return this.role.hashCode();
  }

  @Override
  public String toString() {
    return this.role;
  }
}
